package com.hehua.SingletonOne;

/**
 * 单例模式的实现
 */
public class Singleton {
    private static Singleton singleton = null;
    //私有化构造函数
    private Singleton(){

    }
    //静态公共工厂方法,返回唯一实例
    public static Singleton getInstance(){
        if (singleton == null){
            singleton =  new Singleton();
        }
        return singleton;
    }
}
